package com.dwxt.cdms.controller;

import com.dwxt.cdms.base.Page;
import com.dwxt.cdms.entity.Community;
import com.dwxt.cdms.service.CommunityService;
import com.dwxt.common.base.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/cdms/community")
@RestController
public class CommunityController {

    @Autowired
    private CommunityService communityService;

    /**
     * 分页查询
     */
    @RequestMapping("/page")
    public BaseResult page(Page page) {
        return communityService.page(page);
    }

    /**
     * list查询
     */
    @RequestMapping("/list")
    public BaseResult list() {
        return communityService.list();
    }

    /**
     * 新增
     */
    @RequestMapping("/add")
    public BaseResult add(Community community) {
        return communityService.add(community);
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public BaseResult delete(Integer id){
        return communityService.delete(id);
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public BaseResult update(Community community){
        return  communityService.update(community);
    }
}

